#include "Ctrl.h"

#if AdapterPattern_ 


class  Player
{
protected:
	string name;
public:
	Player(string _name) {
		name = _name;
	}
	virtual void Attack() = 0;
	virtual void Defense() = 0;
};


class Forwards : public Player
{
public:
	Forwards(string _name) : Player(_name) {

	}
	void Attack() override {
		cout << "前锋 " << name << " 进攻" << endl;
	}
	void Defense() override {
		cout << "前锋 " << name << " 防守" << endl;
	}
};


class Center : public Player
{
public:
	Center(string _name) : Player(_name) {

	}
	void Attack() override {
		cout << "中锋 " << name << " 进攻" << endl;
	}
	void Defense() override {
		cout << "中锋 " << name << " 防守" << endl;
	}
};

class Guards : public Player
{
public:
	Guards(string _name) : Player(_name) {

	}
	void Attack() override {
		cout << "后卫 " << name << " 进攻" << endl;
	}
	void Defense() override {
		cout << "后卫 " << name << " 防守" << endl;
	}
};



class ForeignCenter
{
private:
	string name;

public:
	string GetName() const{
		return name;
	}
	void SetName(const string _name) {
		name = _name;
	}
	void 进攻()  {
		cout << "外籍中锋 " << name << " 进攻" << endl;
	}
	void 防守()  {
		cout << "外籍中锋 " << name << " 防守" << endl;
	}

};


class Translator : public Player
{
private:
	ForeignCenter* wjzf = new ForeignCenter();
public :
	Translator(string _name) : Player(_name){
		wjzf->SetName(_name);
	}
	void Attack() override {
		wjzf->进攻();
	}
	void Defense() override {
		wjzf->防守();
	}
};




int main()
{
	Player* b = new Forwards("尼尔");
	b->Attack();

	Player* m = new Guards("麦克");
	m->Attack();

	Player* ym = new Translator("姚明");
	ym->Attack();
	ym->Defense();
}


#endif